package com.chen.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

@Slf4j
@Configuration
public class Scheduled {
    public static void main(String[] args) {

    }

    @PostConstruct
    public void scheduled() {
        Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors()).scheduleWithFixedDelay(() -> {
            log.info(new Date() + "");
        }, 0, 5, TimeUnit.SECONDS);

    }
}
